CW<!-- 教练 – 首页 – 2		index -->
<template>
	<view class="pb60" >
		<view class="" >
			<view class=""  style="position: sticky;top: 0;left: 0;">
				<u-notice-bar mode="horizontal" bg-color=""  :list="gglist"></u-notice-bar>
			</view>
			<view class="w80 f b c mar " style="flex-wrap:wrap;">
				<view class="index-box senter p_t_60 f d c m_t_40" v-if="item.is_xianshi == 1" v-for="(item,index) in list" :key="index"  @click="tomlist(index)">
					<image style="width: 128rpx;height: 128rpx;" :src="item.url" mode=""></image>
					<text class="p_t_10 bold">{{item.name}}</text>
				</view>
			</view>
		</view>
		<!-- 打开首页 弹出提醒打卡 -->
	<!-- 	<view>
			<view class="cover" @click="show = false">

			</view>
			<view class="Details-huod" >
				<view class="senter p_t_31">
					<image style="width: 368rpx;height: 368rpx;" src="../../static/logo.jpg" mode=""></image>
				</view>
				<view class="mar senter fs24 hui bold" style="width:260rpx;">
					<text>今日打卡任务还未完成 快去打卡吧~</text>
				</view>
			</view>
			<view class="index-but">
				<button type="default" @click="ao">去打卡</button>
			</view>
		</view> -->
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:false,
				lis:true,
				list: [{
						url: '../../static/img/059.png',
						name: '考勤打卡',
						is_xianshi:1
					},
					{
						url: '../../static/img/060.png',
						name: '课程打卡',
						is_xianshi:1
					},
					{
						url: '../../static/img/061.png',
						name: '岗位巡查',
						is_xianshi:1
					},
					{
						url: '../../static/img/062.png',
						name: '约课详情',
						is_xianshi:1
					},
					//店长
					{
						url: '../../static/img/093.png',
						name: '添加会员',
						is_xianshi:1
					},
					{
						url: '../../static/img/096.png',
						name: '体验预约',
						is_xianshi:1
					},	
					{
						url: '../../static/img/095.png',
						name: '会员考勤',
						is_xianshi:1
					},
					{
						url: '../../static/img/096.png',
						name: '课程管理',
						is_xianshi:1
					},
					{
						url: '../../static/img/097.png',
						name: '代约课',
						is_xianshi:1
					},
					{
						url: '../../static/img/098.png',
						name: '数据统计',
						is_xianshi:1
					},	
					{
						url: '../../static/img/094.png',
						name: '会员管理',
						is_xianshi:1
					},
					{
						url: '../../static/img/096.png',
						name: '排课管理',
						is_xianshi:1
					},
					
					
				],
				gglist: '',
				token:'',
				userInfo:[]
			}
		},
		onLoad() {
			// 动态导航条文字
			uni.setNavigationBarTitle({
				title: '首页'
			})
		},
		onShow() {
			this.token = uni.getStorageSync('token');
			this.init()
			var userInfo = uni.getStorageSync('userInfo')
			var data = this.list
			if(userInfo){
				switch(userInfo.type){
					case 1://老板
						var qx = [0,0,0,0,1,1,1,1,1,1,1,1]
						for(var i=0; i<data.length;i++){
							data[i].is_xianshi = qx[i]
						}
						this.list = JSON.parse(JSON.stringify(data))
						break;
					case 2://店长
						var qx = [0,0,0,0,1,1,1,1,1,1,1,1]
						for(var i=0; i<data.length;i++){
							data[i].is_xianshi = qx[i]
						}
						this.list = JSON.parse(JSON.stringify(data))
						break;
					case 3://教练
						var qx = [1,1,1,1,0,0,0,0,0,0,0,0]
						for(var i=0; i<data.length;i++){
							data[i].is_xianshi = qx[i]
						}
						this.list = JSON.parse(JSON.stringify(data))
						break;
					case 4://前台
						var qx = [0,0,0,0,1,1,1,1,1,1,1,0]
						for(var i=0; i<data.length;i++){
							data[i].is_xianshi = qx[i]
						}
						this.list = JSON.parse(JSON.stringify(data))
						break;
				}
			}else{
				var qx = [1,1,1,1,1,1,1,1,1,1,1,1]
				for(var i=0; i<data.length;i++){
					data[i].is_xianshi = qx[i]
				}
				this.list = JSON.parse(JSON.stringify(data))
			}
			
		},
		methods: {
			init(){
				this.$http.post(this.$config.UrlPostggList, {}).then((res) => {
					if (res.status == 1) {
						this.gglist = res.data
						if(res.tzarr.is_gz == 0){
							this.$api.alert(res.tzarr.str)
						}
						
					}
				})
			},
			show1(){
				this.show1=false
			},
			tomlist(e) {
				if(this.token == ''){
					this.$api.openWindow("/pages/login/login")
					return
				}
				switch(e) {
				    case 0:
				        uni.navigateTo({
				        	url: "../clock/clock"
				        })
				        break;
				    case 1:
				       uni.navigateTo({
				       	url: "../Course/Course"
				       })
				        break;
					case 2:
						uni.navigateTo({
							url: "../patrol/patrol"
						})
					    break;
					case 3:
						uni.navigateTo({
							url: "../All/All"
						})
					    break;
					case 4:
						this.$api.openWindow("/pages/webview/webview?type="+"add")
					    break;
					case 5:
					   this.$api.openWindow('/pages/webview/webview?type='+"tiyan")
					    break;
					case 6:
						this.$api.openWindow("/pages/member/member")
					    break;
					case 7:
					   this.$api.openWindow("/pages/webview/webview?type="+"kecheng")
					    break;
					case 8:
					   this.$api.openWindow("/pages/webview/webview?type="+"daiyueke")
					    break;
					case 9:
					    this.$api.openWindow('/pages/webview/webview?type='+"shujutongji")
					    break;
					case 10:
						this.$api.openWindow("/pages/webview/webview?type="+"user")
					    break;
					case 11:
						this.$api.openWindow("/pages/webview/webview?type="+"paike")
					    break;
				    
				} 
				
			},
			ao(){
				uni.navigateTo({
					url:"../clock/clock"
				})
			},
		}
	}
</script>

<style>
	.cover {
		position: fixed;
		top: 0;
		width: 100%;
		height: 100vh;
		background: #000000;
		opacity: 0.6;
		z-index: 10;
	}
	.TBB{
		width:100vw;
		position:fixed;
		bottom:0rpx;
	}
	.warps {
		/* height:200vh; */
		overflow: hidden;
		background-color: #F6F8FC;
	}

	.container {
		height: 100vh;
		margin-top: 0rpx;
	}

	.sticky {
		width: 750rpx;
		height: 66rpx;
		line-height: 66rpx;
		background-color: rgba(248, 215, 191, 1.0);
		text-align: center;
	}

	.index-box {
		width: 280rpx;
		height: 280rpx;
		opacity: 1;
		background: #ffffff;
		border-radius: 8rpx;
		box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.06);
	}

	.Details-huod {
		width: 432rpx;
		height: 516rpx;
		opacity: 1;
		background: #ffffff;
		border-radius: 12rpx;
		position: absolute;
		top: 300rpx;
		left: 160rpx;
		z-index: 11;
	}
	.index-but{
		position: absolute;
		top:900rpx;
		left: 160rpx;
		z-index: 11;
	}
	.index-but>button{
		width: 432rpx;
		height: 64rpx;
		line-height:64rpx;
		opacity: 1;
		background: #1f73f2;
		border-radius: 12rpx;
		font-size: 28rpx;
		color:#fff;
	}
</style>
